To set up your own web
content in Windows 7 is to add that content to the existing default
website. This requires no reconfiguration of the server, of IIS, of the
Windows 7 Firewall, of the client computers, or of the router. You
simply add the content, and it’s ready for browsing.
Setting Permissions on the Default Website Folder
Somewhat annoyingly, Windows 7 makes it difficult for you to modify the contents of the wwwroot
folder. For example, if you copy a file to the folder, you need to
enter your User Account Control (UAC) credentials to allow the copy.
Even worse, you get read-only access to the files, so if you edit a file
you can’t save your changes.
To avoid these hassles, you need to adjust the Security permissions on the wwwroot folder to give your Windows 7 user account Full Control. Here are the steps to follow:
1. | Select Start, Computer, and navigate to the inetpub folder on your system drive.
|
2. | Right-click the wwwroot folder, and then click Properties to open the folder’s Properties dialog box.
|
3. | Select the Security tab.
|
4. | Click Edit. Windows 7 displays the Permissions for wwwroot dialog box.
|
5. | Click Add to display the Select Users or Groups dialog box.
|
6. | In the Enter the Object Names to Select text box, type your username, and then click OK to return to the Permissions dialog box.
|
7. | Select your username in the Group or User Names list.
|
8. | In the Permissions list, under the Allow column, click to activate the Full Control check box, as shown in Figure 1.
|
9. | Click OK to return to the Security tab.
|
10. | Click OK to put the new security settings into effect.
|
Adding a File to the Default Website
If you have just a few
web content files that you want to add to the Windows 7 website, you can
add them directly to the default website folder. First, create your web
content file (HTML, ASP, or whatever). Here’s a sample HTML file—which
I’ve named HelloWorld.htm—that I’ll use as an example:
<html>
<head>
<title>Hello World!</title>
</head>
<body>
<div style="font-size: 36pt;
font-family: Verdana;
color: DarkBlue">
Hello Windows 7 World!!
</div>
</body>
</html>
Note
For a primer on Hypertext Markup Language (HTML) and Cascading Style Sheets (CSS), check out my book The Complete Idiot’s Guide to Creating a Website. You can find out more about it at my own site at www.mcfedries.com/.
Caution
Don’t use spaces in the
names of files (or folders) that you add to your website. Although
Internet Explorer may display such pages successfully, other browsers
may not.
Next, save the file to the wwwroot folder.
Caution
If your web content file references other files—for example, an HTML file that uses the <img> tag to reference an image file—be sure to copy those files to the wwwroot
folder. You can either put the files in the root, or you can store them
in a subfolder. For example, you might want to create a subfolder named
images and use it to store your image
files. If you store the files in subfolders, make sure you adjust the
path in your code, as required. For example, if you place a file named HelloWorld.jpg in the images subfolder, you need to add the subfolder to the <img> tag, like so:
<img src="images\HelloWorld.jpg" />
Tip
A quick way to navigate to the wwwroot folder from IIS Manager is to open the Computer, Sites branch (where Computer
is the name of the computer running IIS), select Default Web Site, and
then click Explore in the Actions pane. (You can also right-click
Default Web Site, and then click Explore in the shortcut menu.)
Figure 2 shows the HelloWorld.htm file copied to the wwwroot folder, and Figure 3 shows the file displayed with Internet Explorer.